//
//  ScollViewController.m
//  Tupianliulanqi
//
//  Created by zzn on 2016/12/27.
//  Copyright © 2016年 zzn. All rights reserved.
//

#import "ScollViewController.h"

@interface ScollViewController ()

@property (weak, nonatomic) IBOutlet UIScrollView *scro;

@end

@implementation ScollViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    NSLog(@"%@",_image);
    for (int i = 0; i<_image.count; i++) {
        UIImageView *iv = [[UIImageView alloc]initWithFrame:CGRectMake(i*self.view.frame.size.width, 0, self.view.frame.size.width, self.view.frame.size.height)];
        iv.image = _image[i];
        iv.userInteractionEnabled = YES;
        UITapGestureRecognizer *recog = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(onTap:)];
        [iv addGestureRecognizer:recog];
       
        [self.scro addSubview:iv];
    }
     _scro.contentSize = CGSizeMake(self.view.frame.size.width * _image.count, self.view.frame.size.height);
    
}

- (void)onTap:(UITapGestureRecognizer *)tap
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
